# Maintainer: Alexey Pavlov <Alexpux@gmail.com>

_realname=mpfr

pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
_pkgver=3.1.2
_patchlevel=p8
pkgver=${_pkgver}.${_patchlevel}
pkgrel=2
pkgdesc="Multiple-precision floating-point library"
arch=('any')
url="http://www.mpfr.org/"
groups=("${MINGW_PACKAGE_PREFIX}")
license=('LGPL')
options=('staticlibs')
depends=("${MINGW_PACKAGE_PREFIX}-gmp>=5.0")
makedepends=("${MINGW_PACKAGE_PREFIX}-gmp>=5.0")
source=(http://www.mpfr.org/mpfr-current/mpfr-${_pkgver}.tar.xz{,.asc}
        mpfr-${_pkgver}-${_patchlevel}.patch)
md5sums=('e3d203d188b8fe60bb6578dd3152e05c'
         'SKIP'
         '3280aba9c8ebb1be9dab32d28e97e9a6')

prepare() {
  cd "${srcdir}/${_realname}-${_pkgver}"
  patch -p1 -i $srcdir/${_realname}-${_pkgver}-${_patchlevel}.patch
}

build() {
  cd "${srcdir}/${_realname}-${_pkgver}"

  ./configure --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --enable-static \
    --disable-shared \
    --with-gmp=${MINGW_PREFIX}
  make
}

check() {
  cd "${srcdir}/${_realname}-${_pkgver}"
  make check
}

package() {
  cd "${srcdir}/${_realname}-${_pkgver}"
  make DESTDIR="${pkgdir}" install
}
